home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_c
/
cuj0696.zip
/
DWYER.ZIP
/
GAP.TST
/
GAPMNSD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-23
|
978b
|
25 lines
/* ============ */
/* GapMnSd.c */
/* ============ */
#include <defcodes.h>
#include <math.h>
/* ==================================================================== */
/* CalcGapMeanStdDev - Calculates Mean & Standard Deviation for Gap Test*/
/* ==================================================================== */
void
CalcGapMeanStdDev(int NumGaps, double BaseProb, double *Mean,
double *StdDev)
{
/* ---------------------------------------------------- */
/* NumGaps (IN) - Number of Gaps to be Tabulated */
/* BaseProb (IN) - Probability Measure (GapHi-GapLo) */
/* Mean (OUT) - Average Number of Variates Required */
/* StdDev (OUT) - Corresponding Standard Deviation */
/* */
/* These equations were taken from Knuth, Vol 2, p 535 */
/* ---------------------------------------------------- */
*Mean = NumGaps/BaseProb;
*StdDev = sqrt(NumGaps * (1-BaseProb)) / BaseProb;
}